/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.sanjose.proyectopatpro.entity;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;

/**
 *
 * @author Joverxito
 */
@Entity
@Table(name = "ProgramacionCanal", catalog = "BDSanJose", schema = "dbo")
@NamedQueries({
    @NamedQuery(name = "ProgramacionCanal.findAll", query = "SELECT p FROM ProgramacionCanal p"),
    @NamedQuery(name = "ProgramacionCanal.findByIdProgramacion", query = "SELECT p FROM ProgramacionCanal p WHERE p.idProgramacion = :idProgramacion")})
public class ProgramacionCanal implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "idProgramacion", nullable = false)
    private Short idProgramacion;
    @OneToOne(cascade = CascadeType.ALL, mappedBy = "programacionCanal")
    private Programacion programacion;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idProgramacion")
    private List<Contrato> contratoList;
    @JoinColumn(name = "idCanal", referencedColumnName = "idCanal", nullable = false)
    @ManyToOne(optional = false)
    private Canal idCanal;

    public ProgramacionCanal() {
    }

    public ProgramacionCanal(Short idProgramacion) {
        this.idProgramacion = idProgramacion;
    }

    public Short getIdProgramacion() {
        return idProgramacion;
    }

    public void setIdProgramacion(Short idProgramacion) {
        this.idProgramacion = idProgramacion;
    }

    public Programacion getProgramacion() {
        return programacion;
    }

    public void setProgramacion(Programacion programacion) {
        this.programacion = programacion;
    }

    public List<Contrato> getContratoList() {
        return contratoList;
    }

    public void setContratoList(List<Contrato> contratoList) {
        this.contratoList = contratoList;
    }

    public Canal getIdCanal() {
        return idCanal;
    }

    public void setIdCanal(Canal idCanal) {
        this.idCanal = idCanal;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idProgramacion != null ? idProgramacion.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof ProgramacionCanal)) {
            return false;
        }
        ProgramacionCanal other = (ProgramacionCanal) object;
        if ((this.idProgramacion == null && other.idProgramacion != null) || (this.idProgramacion != null && !this.idProgramacion.equals(other.idProgramacion))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.sanjose.proyectopatpro.entity.ProgramacionCanal[ idProgramacion=" + idProgramacion + " ]";
    }
    
}
